package com.shop.mapper;

import com.shop.pojo.Classifies;
import com.shop.pojo.Classify;
import com.shop.pojo.Good;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface ClassifyMapper {
    @Insert("insert into ftable values(#{id},#{fname},#{fatherId})")
    public int save(Classify classify);
    @Select("select * from ftable where fname like \"%\"#{queryInfo}\"%\"")
    public List<Classify> selectClassify(String queryInfo);
    @Delete("delete from ftable where fid = #{id}")
    public int deleteClassify(int id);
    @Update("update ftable set fname = #{fname}, fatherId = #{fatherId} where fid = #{fid}")
    public int updateClassify(Classify classify);
    @Select("select * from ftable")
    public List<Classify> selectAll();
    @Select("select s.fid,s.fname,s.fatherId ,p.fname pname from ftable as s LEFT JOIN ftable as p on s.fatherId = p.fid where s.fname like \"%\"#{queryInfo}\"%\"")
    public List<Classifies> selectNew(String queryInfo);
    @Select("select * from ftable where fid = #{fid}")
    public Classify selectById(int fid);
}
